bitkeeper revision 1.730 (403255aarVxNJS1lCbHzxzUP9v-rRA)
authorkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Tue, 17 Feb 2004 17:55:54 +0000 (17:55 +0000)
committerkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Tue, 17 Feb 2004 17:55:54 +0000 (17:55 +0000)
XenoUtil.py:
  Forward port from 1.2 to allocate VD space from fastest part of the disc first.

tools/xc/py/XenoUtil.py

index e3b49bd99a586f3400ed227acd79cea180aef02d..06a623e9bb30d2f77b7773a8fec2407e8b8fe053 100644 (file)
@@ -276,12 +276,14 @@ def vd_format(partition, extent_size_mb):
         else:
             new_id = 0
 
-        for i in range(part_info['nr_sectors'] / extent_size):
+        num_extents = part_info['nr_sectors'] / extent_size
+
+        for i in range(num_extents):
             sql ="""INSERT INTO vdisk_extents(vdisk_extent_no, vdisk_id,
                                               part_id, part_extent_no)
                     VALUES ("""+ str(new_id + i) + ", 0, "\
                                + str(blkdev_name_to_number(partition))\
-                               + ", " + str(i) + ")"
+                               + ", " + str(num_extents - (i + 1)) + ")"
             cu.execute(sql)
 
     cx.commit()